package cz.proks.schoolpupilbook.gae.restlet.resource;

import cz.proks.schoolpupilbook.gae.dao.MarkDAO;
import cz.proks.schoolpupilbook.shared.domain.Mark;
import cz.proks.schoolpupilbook.shared.restlet.RestMapping;

public class MarkServerResource extends BaseServerResource implements MarkResource {
	private MarkDAO dao = new MarkDAO();
	
	@Override
	public Mark retrieve() {
		String markId = (String) getRequestAttributes().get(RestMapping.PARAMETER_MARK_ID);
				
		if (markId == null || markId.isEmpty())
			return null;
		
		Mark mark = dao.find(markId); 
		return mark;		
	}

	@Override
	public void store(Mark obj) {				
		dao.save(obj);		
	}
}
